﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PCS_Linh.lab03
{
    class JaggedArray
    {
        public void run()
        {
            Console.Write("Please enter the number of rows: ");
            int n = Convert.ToInt32(Console.ReadLine());

            int[][] a = new int[n][];
            for (int i = 0; i < n; i++)
            {
                Console.Write("Number of element of row {0}: ", i);
                int m = Convert.ToInt32(Console.ReadLine());
                a[i] = new int[m];

                for (int j = 0; j < m; j++)
                {
                    Console.Write("a[{0}][{1}] = ", i, j);
                    a[i][j] = Convert.ToInt32(Console.ReadLine());
                }
            }
            Console.WriteLine("The value of jagged array: ");
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < a[i].Length; j++)
                {
                    Console.Write("{0,5}", a[i][j]);
                }
                Console.WriteLine();
            }
        }
    }
}
